package com.surpass.profiles.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.surpass.profiles.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Surpass
 * @Package com.surpass.profiles
 * @Description: ${todo}
 * @date 2020/9/2 14:48
 */
@RestController
public class Controller {

    @Value("${custom.value}")
    private String customValue;

    @RequestMapping(value = "/userInfo/{id}",method = RequestMethod.GET)
    public JSON getUserInfo(@PathVariable("id")String id){
        User user = new User(id);
        user.setMessage(customValue);
        return JSONObject.parseObject(JSON.toJSONString(user));
    }
}
